Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E- and H-field interpolation tests, frequency domain interpolation #80

Merged
merged 174 commits into from
Oct 17, 2022

Conversation

willGraham01
Copy link
Collaborator

@willGraham01 willGraham01 commented Sep 5, 2022

Interpolation Tests for the $E$- and $H$-fields.

Dependent on #74 | Dependent on #108 (namespacing issues)

Completes the following tasks in #44:

Tests the performance of the BLi interpolation methods against the MATLAB function the scheme is based off. MATLAB scripts which output the error for particular field choices are included in the tests/unit/matlab_benchmark_scripts directory. The output error values are currently hard-coded into the respective tests; this is not an ideal solution, however in light of #70 is an adequate testing method until the MATLAB dependency question is answered.

The tests themselves are against MATLAB's interp function. Using predefined functional forms for the components of the two fields; and a particular grid setup to mimic the Yee cells and stored field components, the maximum pointwise-error of the interpolation to the Yee cell centres is computed, and compared to that from MATLAB.

Tests of the BLi method for complex data has been added to test_interpolation_functions.
A field-wide time-domain interpolation test has been added to test_field_interpolation.cpp.

Completes the following task in #44:

The codebase currently uses mxArrays to encode complex fields, and the functions mxInterpolateFieldCentral{E,H} to handle the interpolation. The new functions use complex as the datatype for the inputs. This is to be consistent with test_numerical_derivative and field.h, and to use a complex datatype we are importing already (and which won't be removed by #70). However, these functions will be are unused by the code, as the mxInterpolate functions are still used until iterator's refactor is complete.

It is also worth noting that interpolation in the frequency domain does not appear to use split-field components, unlike that in the time domain. As such, the functionality of the time domain and frequency domain functions are slightly different (which doesn't permit templating).

A test on the frequency-domain interpolation has been added to test_field_interpolation.cpp.

Key Files to Check:

  • test_field_interpolation.cpp
  • test_BLi_vs_cubic_interpolation.cpp
  • interpolate_{E,H}.h (although these changes just turn the field-interpolation functions into template functions, so we can use double (time domain) or std::complex<double> (freq domain) data in each.

willGraham01 and others added 30 commits August 3, 2022 10:34
Copy link
Collaborator

@prmunro prmunro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This broadly looks great. I have made some comments which I think need some attention. Apologies if I have misunderstood something!

Copy link
Member

@samcunliffe samcunliffe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving, for my part.
Obv. subject to Peter's change requests as above.

.github/workflows/macos_tests.yml Outdated Show resolved Hide resolved
willGraham01 and others added 6 commits October 17, 2022 09:11
* Fix tensor3D allocation

* Add split-E-field interpolation as class method

* Update split-H-field class with interpolation method

* Overhaul ElectricField to have interpolation method

* H-field has interpolation methods

* Remove redundant headers now class methods are established

* Update tdms/include/arrays.h

Co-authored-by: Sam Cunliffe <[email protected]>

* Move interpolation functionality higher up class hierarchy

* Add overrides for MacOS compilation

Co-authored-by: Sam Cunliffe <[email protected]>
@willGraham01 willGraham01 merged commit d98a564 into main Oct 17, 2022
@willGraham01 willGraham01 deleted the wgraham-FieldInterpTests branch October 17, 2022 16:08
willGraham01 added a commit that referenced this pull request Dec 12, 2022
* Small inline function absorbed into unit test utils

* Refactor benchmark test

* Refactor long BLi benchmark test

* Refactor duplicate functions into unit_test_utils
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants